/** \file InstrumentMonophonique
    \author belot.nicolas
    Manage an monophonic instrument like a flute
*/

#ifndef INSTRUMENTMONOPHONIQUE_H
#define INSTRUMENTMONOPHONIQUE_H 1

#include <queue>
#include <deque>
#include <map>
#include "Instrument.h"

namespace libtrckr {

class InstrumentMonophonique : public Instrument {
public :
	/** \class libtrckr::InstrumentMonophonique
	    \brief Instrument that can play only one note at a time.
	*/
	//Constructor
	//should be ...Instrument is an interface.
	InstrumentMonophonique();
	InstrumentMonophonique( string );//,name
	InstrumentMonophonique( const InstrumentMonophonique&);
	~InstrumentMonophonique();

	//Accessor
	//Information
	string getName() const ;
	DynArray<string> getTuning() const;//Huh! vector :s
	DynArray<string> getAttacks() const;

	//Creation 
	void setName( string );
	void setTuning( DynArray<string> );
	/**
	\param name note name
	\param file file containing the samples
	\param speed speed of the playback (change the pitch of the not)
	\param panning set to 0
	\param att Attack type
	\param where set to 0
	*/
	void setNote( string, string,float,short,short,short);// ça devrais plutot prendre un string filename.
	void setAttack(DynArray<string>);
	void setAttack(string**);

	//Function working with the rest of the libs.
	 Buffer play( uint );//play xsample.
	 Buffer& play( Buffer & );//play xsample.
	/**
	\param name note name
	\param duration length of the note
	\param point is the note pointed 
	\param volume 
	\param att which attack did we use 
	\param where set to 0
	\param eff an dynArray of PlayingEffects.
	**/
	 void addNote(string, Duration::note_duration_t,bool, uint,short,short,DynArray<PlayingEffect*>*) ;
	///\overload
	 void addNote(Note, uint,short,short,DynArray<PlayingEffect*>*) ;
	bool end() const;
	void letRing(bool);
private:
	string _name;
	string _tune; 
	queue<INote> _partition;
	DynArray<map<string, INote>*> _samples;
	DynArray<string> attack;
	uint8_t nb_attack;
	Sample *current;
	uint elapsed;
	uint duration;
	double mvolume;
	double ratio;
	DynArray<PlayingEffect*>* effects;
};

}

#endif

